from .strutil import is_valid_pwd, is_valid_email


def pwd_checker(v):
    if not is_valid_pwd(v):
        raise ValueError("length of password is required 6 to 24 characters, only support numbers and letters")
    return v


def email_checker(v):
    if v:
        v = v.strip().lower()
        if not is_valid_email(v):
            raise ValueError("invalid email address")
    return v
